<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>字典管理</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">
        function page(n, s) {
            $("#pageNo").val(n);
            $("#pageSize").val(s);
            $("#searchForm").submit();
            return false;
        }
    </script>
</head>
<body>
<%--<ul class="nav nav-tabs">--%>
    <%--<li class="active"><a href="${ctx}/sys/dict/">字典列表</a></li>--%>
    <%--<shiro:hasPermission name="sys:dict:edit">--%>
        <%--<li><a href="${ctx}/sys/dict/form?sort=10">字典添加</a></li>--%>
    <%--</shiro:hasPermission>--%>
<%--</ul>--%>

<div class="wrapper wrapper-content">
    <div class="ibox">
        <div class="ibox-title">
            <h5>字典列表 </h5>
        </div>
        <div class="ibox-content">

            <sys:message content="${message}"/>

            <!-- 查询条件 -->
            <div class="row">
                <div class="col-sm-12">
                    <form:form id="searchForm" modelAttribute="dict" action="${ctx}/sys/dict/" method="post"
                               class="breadcrumb form-search">
                        <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                        <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                        <label>类型：</label><form:select id="type" path="type" class="input-medium">
                        <form:option value="" label=""/>
                        <form:options items="${typeList}" htmlEscape="false"/></form:select>
                        &nbsp;&nbsp;<label>描述 ：</label><form:input path="description" htmlEscape="false" maxlength="50"
                                                                   class="input-medium"/>
                        &nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
                    </form:form>
                </div>
            </div>

            <!-- 工具栏 -->
            <div class="row">
                <div class="col-sm-12">
                    <div class="pull-left">
                        <shiro:hasPermission name="sys:dict:edit">
                            <table:addRow url="${ctx}/sys/dict/form?sort=10" title="字典" ></table:addRow>
                            <table:importExcel url="${ctx}/sys/dict/import"></table:importExcel><!-- 导入按钮 -->
                        </shiro:hasPermission>
                    </div>

                    <div class="pull-right">
                        <button  class="btn btn-primary btn-rounded btn-outline btn-sm " onclick="search()" ><i class="fa fa-search"></i> 查询</button>
                        <button  class="btn btn-primary btn-rounded btn-outline btn-sm " onclick="reset()" ><i class="fa fa-refresh"></i> 重置</button>
                    </div>
                </div>
            </div>


            <table id="contentTable" class="table table-striped table-bordered table-hover table-condensed dataTables-example dataTable">
                <thead>
                <tr>
                    <th>键值</th>
                    <th>标签</th>
                    <th>类型</th>
                    <th>描述</th>
                    <th>排序</th>
                    <shiro:hasPermission name="sys:dict:edit">
                        <th>操作</th>
                    </shiro:hasPermission></tr>
                </thead>
                <tbody>
                <c:forEach items="${page.list}" var="dict">
                    <tr>
                        <td>${dict.value}</td>
                        <td><a href="${ctx}/sys/dict/form?id=${dict.id}">${dict.label}</a></td>
                        <td><a href="javascript:"
                               onclick="$('#type').val('${dict.type}');$('#searchForm').submit();return false;">${dict.type}</a>
                        </td>
                        <td>${dict.description}</td>
                        <td>${dict.sort}</td>
                        <shiro:hasPermission name="sys:dict:edit">
                            <td>
                                <a href="#" onclick="openDialogView('查看字典信息', '${ctx}/sys/dict/form?id=${dict.id}','720px', '420px')" class="btn btn-info btn-xs" title="查看">
                                    <i class="fa fa-search-plus"></i> 查看
                                </a>
                                <a href="#" onclick="openDialog('修改字典信息', '${ctx}/sys/dict/form?id=${dict.id}','720px', '420px')" class="btn btn-success btn-xs" title="修改"><i class="fa fa-edit"></i><span class="hidden-xs">修改</span></a>

                                <a href="${ctx}/sys/dict/delete?id=${dict.id}&type=${dict.type}" onclick="return confirmx('确认要删除该字典内容吗？', this.href)" class="btn  btn-danger btn-xs" title="删除"><i class="fa fa-trash"></i><span class="hidden-xs">删除</span></a>

                                <a href="#" onclick="openDialog('添加键值信息', '${ctx}/sys/dict/form?type=${dict.type}&sort=${dict.sort+10}','720px', '420px')" class="btn btn-info btn-xs" title="添加键值">
                                    <i class="fa fa-plus"></i> 增加键值
                                </a>
                            </td>
                        </shiro:hasPermission>
                    </tr>
                </c:forEach>
                </tbody>
            </table>

            <table:page page="${page}"></table:page>
        </div>

    </div>
</div>

</body>
</html>